home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / ABUSESRC.ZIP / AbuseSrc / imlib / include / image24.hpp < prev    next >
C/C++ Source or Header  |  1996-04-11  |  1KB  |  38 lines

  1. #ifndef __IMAGE_24__
  2. #define __IMAGE_24__
  3.  
  4. #include "palette.hpp"
  5. #include "macs.hpp"
  6. #include "filter.hpp"
  7.  
  8. class image24
  9. {
  10.   int w,h;
  11.   unsigned char *data;  
  12. public :
  13.   int width() { return w; }
  14.   int height() { return h; }
  15.   image24(unsigned short width, unsigned short height,
  16.           unsigned char *buffer=NULL);          
  17.   void pixel(short x, short y, unsigned char &r, 
  18.                                unsigned char &g,
  19.                    unsigned char &b)
  20.     { CHECK(x>=0 && y>=0 && x<w && y<h);
  21.       unsigned char *p=data+y*w*3; r=*(p++); g=*(p++); b=*(p++); }
  22.   void putpixel(short x, short y, unsigned char r,
  23.                   unsigned char g, 
  24.                       unsigned char b)
  25.     { CHECK(x>=0 && y>=0 && x<w && y<h);
  26.       unsigned char *p=data+(y*w+x)*3; *(p++)=r; *(p++)=g; *(p++)=b; }
  27.   unsigned char *scan_line(short y) { return data+y*w*3; }
  28.   image *dither(palette *pal);
  29.   void           clear              (unsigned char r=0, unsigned char g=0, 
  30.                                 unsigned char b=0);   
  31.   void add_error(int x, int y, int r_error, int g_error, int b_error, int error_mult);  
  32.   ~image24() { jfree(data); }
  33. } ;
  34.  
  35.  
  36. #endif
  37.  
  38.